#!/usr/bin/python2.5
# LEAVE THE FOLLOWING TWO LINES
# GAME BAKER
# yaml
# 0
s = """
!!python/object:game.Game
gameobjects:
  Framerate: &id002 !!python/object:game.GameObject
    baseworkstate: ws_framerate
    name: Framerate
    objtype: Gameobject
    requires: []
    sprite: null
  Ship: !!python/object:game.GameObject
    baseworkstate: ws_ship
    name: Ship
    objtype: Gameobject
    requires: []
    sprite: null
  emitter: !!python/object:game.GameObject
    baseworkstate: ws_emitter
    name: emitter
    objtype: Gameobject
    requires: []
    sprite: null
  emitter2: &id003 !!python/object:game.GameObject
    baseworkstate: ws_emitter2
    name: emitter2
    objtype: Gameobject
    requires: []
    sprite: null
  floor: &id001 !!python/object:game.GameObject
    baseworkstate: ws_floor
    name: floor
    objtype: Gameobject
    requires: []
    sprite: null
  particle: !!python/object:game.GameObject
    baseworkstate: ws_particle
    name: particle
    objtype: Gameobject
    requires: []
    sprite: explosionsprite
gamescreens:
  None: !!python/object:game.GameScreen
    color: !!python/tuple [0, 0, 0]
    dimensions: !!python/tuple [800, 600]
    objtype: Gamescreen
    startobjects:
    - *id001
    - *id002
    - *id003
initcode: import random
objtype: Game
sprites:
  explosionsprite: !!python/object:game.Sprite
    alphakey: !!python/tuple [0, 0, 0]
    framerate: 1
    imagefiles:
    - bottomright: !!python/tuple [60, 42]
      filename: images/BlenderExplosionSmall.bmp
      topleft: !!python/tuple [0, 0]
    - bottomright: !!python/tuple [120, 42]
      filename: images/BlenderExplosionSmall.bmp
      topleft: !!python/tuple [60, 0]
    - bottomright: !!python/tuple [180, 42]
      filename: images/BlenderExplosionSmall.bmp
      topleft: !!python/tuple [120, 0]
    - bottomright: !!python/tuple [240, 42]
      filename: images/BlenderExplosionSmall.bmp
      topleft: !!python/tuple [180, 0]
    - bottomright: !!python/tuple [300, 42]
      filename: images/BlenderExplosionSmall.bmp
      topleft: !!python/tuple [240, 0]
    - bottomright: !!python/tuple [360, 42]
      filename: images/BlenderExplosionSmall.bmp
      topleft: !!python/tuple [300, 0]
    name: explosionsprite
    objtype: Sprite
startscreen: None
title: ''
workstates:
  ws_emitter: !!python/object:game.WorkState
    actions: {1: 'self.x = 100

        self.y = 400

        self.vx = 4

        self.vy = 0


        self.vars["particles"] = {}


        self.resize(0,0)


        self.set_timer(2)


        ', 3: "\\nself.move_velocity()\\n\\n\\nparticles  = self.vars[\\"particles\\"]\\n\\
        \\nmatches = gamescreen.get_collisions(self.vars[\\"particles\\"].keys(),\\"floor\\"\\
        )\\n\\n\\nfor name1,name2 in matches:\\n\\n\\tif name1 == \\"floor\\": \\n\\t\\tpass\\n\\
        \\telse:\\n\\t\\tif name2 == \\"floor\\":\\n\\t\\t\\tparticles[name1].vy = -0.7 * particles[name1].vy\\n\\
        \\t\\t\\tparticles[name1].move_velocity()\\n\\t\\t\\tcontinue\\n\\t\\t# find collision\\
        \\ direction\\n\\t\\tp1 = particles[name1]\\n\\t\\tx = p1.x - particles[name2].x\\n\\
        \\t\\ty = p1.y - particles[name2].y\\n\\n\\t\\tmult = 30./(x*x + y*y+0.01)\\n\\n\\t\\
        \\tp1.vx += x * mult\\n\\t\\tp1.vy += y * mult", 9: '

        self.vx = - self.vx', 11: 'name = "p" + str(int( 450 * random.random() ) )

        a = gamescreen.add_object("particle", name )

        a.x = self.x

        a.y = self.y


        self.vars["particles"][name] = a


        self.set_timer(0.0+0.3 * random.random())

        '}
    inherits: null
    objtype: Workstate
  ws_emitter2: !!python/object:game.WorkState
    actions: {1: 'self.x = 300

        self.y = 200


        self.vx = 0

        self.vy = 0


        self.resize(0,0)


        self.vars["particles"]={}


        self.set_timer(1)'}
    inherits: ws_emitter
    objtype: Workstate
  ws_floor: !!python/object:game.WorkState
    actions: {1: 'self.resize(800,100)


        self.color=(50,50,50)

        self.clear()

        self.x=0

        self.y = 500

        self.z = 1'}
    inherits: null
    objtype: Workstate
  ws_framerate: !!python/object:game.WorkState
    actions: {1: 'self.x = 0

        self.y = 0

        self.z = 100

        self.resize(60,25)

        pass', 3: 'self.clear()

        self.draw_text(str(int(game.get_fps())),size=20,colour=(255,0,0))'}
    inherits: null
    objtype: Workstate
  ws_particle: !!python/object:game.WorkState
    actions: {1: '

        self.x = 400

        self.y = 300

        self.vx = 3 - int(random.random() * 6)

        self.vy = - 4*(4 + int(random.random() * 3))

        self.resize(58,43)

        self.color = (190 +int( 65*random.random()),25 + int(70 * random.random()),30)

        self.clear()


        self.set_timer(16)', 3: '

        self.move_velocity()

        self.vy +=1

        ', 9: '

        self.vx = -0.8 * self.vx

        #self.destroy()', 11: '

        self.destroy()'}
    inherits: null
    objtype: Workstate
  ws_ship: !!python/object:game.WorkState
    actions: {1: 'self.x = 80

        self.y = 390

        self.z = 10

        self.vx = 4

        self.vy = 0

        self.resize(10,75)

        self.color=(0,0,255)

        self.clear()

        pass', 3: '

        self.move_velocity()', 9: '

        self.vx = - self.vx

        '}
    inherits: null
    objtype: Workstate

"""
if __name__ == "__main__":
  import gbfileio,sys,runtime
  game = gbfileio.loadgame(sys.argv[0])
  runtime.run_game(game)
